package com.org.service.facotry;

import com.org.constant.AgreementTypeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 协议工厂
 */
@Component
public class AgreementFactory {

    @Autowired
    private Map<String, AgreementService> agreementDetailMap;

    public AgreementService getAgreementDetail(String type) {
        AgreementService agreementDetail = agreementDetailMap.get(type);
        if (agreementDetail == null) {
            return agreementDetailMap.get(AgreementTypeEnum.DEFAULT.getType());
        }
        return agreementDetail;
    }
}
